import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [
    {
        path: '/',
        redirect: '/seat',


    },
    {
        // 404页面
        path: '*',
        component: () => import(/* webpackChunkName: "error" */'@/views/layout/seat')
    },
    {
        path: '/seat',
        name: 'seat',
        component: () => import('@/views/layout/seat'),
    },

    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/index'),
    },
    {
        path: '/manage',
        name: 'manage',
        component: () => import(/* webpackChunkName: "about" */ '../views/layout/index'),
        children: [

            {
                path: '/order',

                component: () => import('@/views/order/order'),
            },
            {
                path: '/orderList',

                component: () => import('@/views/order/orderList'),
            },
            {
                path: '/dataList',

                component: () => import('@/views/order/dataList'),
            }
        ]
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
